Strictness Properties of Lazy Algebraic Datatypes
نویسنده
چکیده
A new construction of a finite set of strictness properties for any lazy algebraic datatype is presented. The construction is based on the categorical view of the solutions to the recursive domain equations associated with such types as initial algebras. We then show how the initial algebra induction principle can be used to reason about the entailment relation on the chosen collection of properties. We examine the lattice of properties given by our construction for the type nlist of lazy lists of natural numbers and give proof rules which extend the conjunctive strictness logic of [2] to a language including the type nlist. 1 I n t r o d u c t i o n This paper concerns the problem of extending an ideal-based strictness analysis for a PCF-like language (e.g. the abstract interpretation of [4] or the strictness logic of [2, 6]) to a language which includes lazy algebraic datatypes, such as lazy lists or trees. We start by giving a brief overview of ideal-based strictness analysis, using the language of strictness logic 1. A more comprehensive account can be found in [1]. At each type a of our language AT we define a propositional theory L~ = (L~, <~) where L~ i s a set of propositions and _<oC L a x L~ is the (finitely axiomatised) entailment relation. Each proposition r is interpreted as a non-empty Scott-closed subset (i.e. an ideal) [r of the domain Da which interprets the type a in the standard denotational semantics for AT. For d E D~, r E s write d ~ r for d E [r We require soundness of s with respect to its intended interpretation, so r < r implies that [r _ [r and we can sometimes get the converse (completeness) too. For decidability, we require that the Lindenbaum algebra s of the theory s be finite. We shall assume tha t s contains at least the propositions t ~ (with It I ---D~) *Author's address: University of Cambridge, Computer Laboratory, New Museums Site, Pembroke Street, Cambridge CB2 3QG, UK. Email: Nick.Benton0cl. cam. ac .uk. Research supported by the Cambridge Philosophical Society and a SERC Fellowship. 1Most of the present work can, however, be easily reinterpreted in terms of a more traditional abstract interpretation.
منابع مشابه
Strictness Meets Data Flow
Properties of programs can be formulated using various techniques: dataflow analysis, abstract interpretation and type-like inference systems. This paper reconstructs strictness analysis (establishing when function parameters are evaluated in a lazy language) as a dataflow analysis by expressing the dataflow properties as an effect system. Strictness properties so expressed give a clearer opera...
متن کاملHigher Order Demand Propagation
In this report a new backward strictness analysis for functional languages is presented. It is called higher order demand propagation and is applicable to a realistic non-strict functional language, which has a polymorphic type system and supports higher order functions and user definable algebraic data types. This report defines a semantics for higher order demand propagation and relates it to...
متن کاملProving Lazy Folklore with Mixed Lazy/strict Semantics
Abstract. Explicit enforcement of strictness is used by functional programmers for many different purposes. Few functional programmers, however, are aware that explicitly enforcing strictness has serious consequences for (formal) reasoning about their programs. Some vague “folklore” knowledge has emerged concerning the correspondence between lazy and strict evaluation but this is based on exper...
متن کاملHyperstrictness and the Parallel Evaluation of Lazy Functional Programs
Strictness analysis can be used for automatic parallelization of lazy functional programs while preserving their semantics (and termination properties, in particular). This paper considers ways of exploiting strictness analysis in implementing functional languages eeciently on stock parallel hardware. A strictness{based parallel evaluation model is presented, and is compared with the more gener...
متن کاملTransport of finiteness structures and applications
We describe a general construction of finiteness spaces which subsumes the interpretations of all positive connectors of linear logic. We then show how to apply this construction to prove the existence of least fixpoints for particular functors in the category of finiteness spaces: these include the functors involved in a relational interpretation of lazy recursive algebraic datatypes along the...
متن کامل